package com.LittleHan.crm.exceptionHandler;

import com.LittleHan.crm.exception.LoginException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class UserLoginExceptionHandler {
    @ExceptionHandler(LoginException.class)
    @ResponseBody
    public String loginException(Exception e){
        String msg=e.getMessage();
        //{"msg":"msg","msg":"false"}
        //return "{\"msg\":\"false\"}";
        return "{\"msg\":\""+msg+"\",\"success\":\"false\"}";
    }
}
